package com.example.mobile2032021606168xmy0617homework;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    public MySQLiteOpenHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "create table users(_id integer primary key autoincrement,name varchar(20) ,jineng Text,xinchou integer)";
        db.execSQL(sql);
        ContentValues values=new ContentValues();
        values.put("name","崔胜贤");
        values.put("jineng","汽车工程师");
        values.put("xinchou",3500);
        db.insert("users",null,values);
        values.put("name","东永裴");
        values.put("jineng","汽车工人");
        values.put("xinchou",3200);
        db.insert("users",null,values);
        values.put("name","权志龙");
        values.put("jineng","汽车技术人员");
        values.put("xinchou",3000);
        db.insert("users",null,values);
        values.put("name","姜大声");
        values.put("jineng","汽车检测人员");
        values.put("xinchou",3000);
        db.insert("users",null,values);
        values.put("name","李胜利");
        values.put("jineng","汽车厂工人");
        values.put("xinchou",2800);
        db.insert("users",null,values);
        values.put("name","龚俊");
        values.put("jineng","汽车厂工程师");
        values.put("xinchou",2900);
        db.insert("users",null,values);
        values.put("name","张哲瀚");
        values.put("jineng","汽车厂工人");
        values.put("xinchou",3000);
        db.insert("users",null,values);


    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
